/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jus.aor.printing;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

/**
 *
 * @author fx
 */
class TCP {
    static void writeData(Socket soc, InputStream is) throws IOException {
        // todo
        OutputStream os=soc.getOutputStream();
    }
    static void writeProtocole(Socket soc, Notification notification) throws IOException {
                int notif = notification.ordinal();
                try (OutputStream os = soc.getOutputStream(); 
                     DataOutputStream dos = new DataOutputStream(os)) {
                        dos.write(notif);
                }
    }
  
    static Notification readProtocole(Socket soc) throws IOException {
                int notif;
                try (InputStream is = soc.getInputStream(); 
                     DataInputStream dis = new DataInputStream(is)) {
                        notif = dis.readInt();
                }
        return Notification.values()[notif];
    }
}
